package xjtu.se.articlecommunity.common;

public interface CacheService {

    /**
     * Save the verification code to the cache
     * @param key User the verification code belongs，it can be mail，tel or u_id
     * @param code verification code
     * @return verification code
     */
    String saveVerificationCode(String key, String code);

    /**
     * search verification code in the cache
     * @param key
     * @return null, if there is no verification code in the cache
     * @return verification code saved in cache, if there is a verification code in the cache
     */
    String findVerificationCode(String key);

    /**
     * remove the verification after it is used
     * @param key
     */
    void clearVerificationCode(String key);
}
